<?php

namespace common\models\Invitation;

use Yii;
use common\models\Expert\Expert;
use common\models\Expert\ExpertSearch;

/**
 * This is the model class for table "invitation".
 *
 * @property integer $id
 * @property string $send
 * @property integer $eid
 */
class Invitation extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'invitation';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['email','xinxi','eid'], 'required'],
            [['eid'], 'integer'],
            [['email','xinxi'], 'string', 'max' => 255],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => Yii::t('app', 'ID'),
            'eid' => Yii::t('app', '专家'),
            'email' => Yii::t('app', '专家邮箱'),
            'xinxi' => Yii::t('app', '消息'),
            
        ];
    }

    public static function getExpert($id){
         if(Expert::findOne($id)){
            return Expert::findOne($id)->username;
        }else{
            return '';
        }
    }
    public static function getMail($id){
         if(Expert::findOne($id)){
            return Expert::findOne($id)->email;
        }else{
            return '';
        }
    }
}
